import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserQuery, UserVo, UserForm } from './types';

// 查询用户列表
export function listUser(query: UserQuery): AxiosPromise<any> {
    return request({
        url: '/user/user/list',
        method: 'get',
        params: query
    });
}

// 查询用户详细
export function getUser(id: number): AxiosPromise<any> {
    return request({
        url: '/user/user/' + id,
        method: 'get'
    });
}

// 新增用户
export function addUser(data: UserForm): AxiosPromise<any> {
    return request({
        url: '/user/user',
        method: 'post',
        data: data
    });
}

// 修改用户
export function updateUser(data: UserForm): AxiosPromise<any> {
    return request({
        url: '/user/user',
        method: 'put',
        data: data
    });
}

// 删除用户
export function delUser(ids: number[]): AxiosPromise<any> {
    return request({
        url: '/user/user/' + ids,
        method: 'delete'
    });
}
